const baseMixins = {
  data() {
    const {
      windowHeight
    } = uni.getSystemInfoSync()
    return {
      windowHeight,
      fullStyle: `height:100%;width:750rpx`,
      contentStyle: 'height: calc(100% - 300rpx);'
    }
  },

  methods: {
    goSubPage(url) {
      uni.navigateTo({url});
    },
    goTabPage(url) {
      uni.switchTab({url});
    },
    showLoading(title = '加载中') {
      uni.showLoading({title});
    },
    getParams(url) {
      const regex = /[?&]([^=#]+)=([^&#]*)/g;
      const params = {};
      let match;
      while (match = regex.exec(url)) {
        params[decodeURIComponent(match[1])] = decodeURIComponent(match[2]);
      }
      return params;
    }
  },
}

export {baseMixins}
